package cn.ibizlab.todo.core.pms.domain;

import java.sql.Timestamp;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.math.BigInteger;
import java.util.HashMap;
import java.math.BigDecimal;
import java.text.SimpleDateFormat;
import com.alibaba.fastjson.annotation.JSONField;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonFormat;
import org.springframework.util.ObjectUtils;
import org.springframework.util.DigestUtils;
import cn.ibizlab.todo.util.domain.EntityBase;
import cn.ibizlab.todo.util.annotation.DEField;
import cn.ibizlab.todo.util.enums.DEPredefinedFieldType;
import cn.ibizlab.todo.util.enums.DEFieldDefaultValueType;
import cn.ibizlab.todo.util.helper.DataObject;
import cn.ibizlab.todo.util.enums.DupCheck;
import java.io.Serializable;
import lombok.*;
import org.springframework.data.annotation.Transient;
import cn.ibizlab.todo.util.annotation.Audit;

import cn.ibizlab.todo.util.domain.EntityClient;

/**
 * ServiceApi [用户] 对象
 */
@Data
public class User extends EntityClient implements Serializable {

    /**
     * 源代码账户
     */
    @JSONField(name = "commiter")
    @JsonProperty("commiter")
    private String commiter;

    /**
     * 真实姓名
     */
    @JSONField(name = "realname")
    @JsonProperty("realname")
    private String realname;

    /**
     * 通讯地址
     */
    @JSONField(name = "address")
    @JsonProperty("address")
    private String address;

    /**
     * 钉钉
     */
    @JSONField(name = "dingding")
    @JsonProperty("dingding")
    private String dingding;

    /**
     * 手机
     */
    @JSONField(name = "mobile")
    @JsonProperty("mobile")
    private String mobile;

    /**
     * 微信
     */
    @JSONField(name = "weixin")
    @JsonProperty("weixin")
    private String weixin;

    /**
     * 密码
     */
    @JSONField(name = "password")
    @JsonProperty("password")
    private String password;

    /**
     * 电话
     */
    @JSONField(name = "phone")
    @JsonProperty("phone")
    private String phone;

    /**
     * 性别
     */
    @JSONField(name = "gender")
    @JsonProperty("gender")
    private String gender;

    /**
     * 邮箱
     */
    @JSONField(name = "email")
    @JsonProperty("email")
    private String email;

    /**
     * 最后登录
     */
    @DEField(defaultValue = "0")
    @JSONField(name = "last")
    @JsonProperty("last")
    private Integer last;

    /**
     * 访问次数
     */
    @DEField(defaultValue = "0")
    @JSONField(name = "visits")
    @JsonProperty("visits")
    private Integer visits;

    /**
     * 账户
     */
    @JSONField(name = "account")
    @JsonProperty("account")
    private String account;

    /**
     * QQ
     */
    @JSONField(name = "qq")
    @JsonProperty("qq")
    private String qq;

    /**
     * ID
     */
    @DEField(isKeyField=true)
    @JSONField(name = "id")
    @JsonProperty("id")
    private Long id;

    /**
     * nickname
     */
    @JSONField(name = "nickname")
    @JsonProperty("nickname")
    private String nickname;

    /**
     * 逻辑删除标志
     */
    @DEField(defaultValue = "0" , preType = DEPredefinedFieldType.LOGICVALID, logicval = "0" , logicdelval="1")
    @JSONField(name = "deleted")
    @JsonProperty("deleted")
    private String deleted;

    /**
     * ip
     */
    @JSONField(name = "ip")
    @JsonProperty("ip")
    private String ip;

    /**
     * avatar
     */
    @JSONField(name = "avatar")
    @JsonProperty("avatar")
    private String avatar;

    /**
     * locked
     */
    @DEField(defaultValue = "0000-00-00 00:00:00")
    @JsonFormat(pattern="yyyy-MM-dd HH:mm:ss", locale = "zh" , timezone="GMT+8")
    @JSONField(name = "locked" , format="yyyy-MM-dd HH:mm:ss")
    @JsonProperty("locked")
    private Timestamp locked;

    /**
     * clientLang
     */
    @DEField(defaultValue = "zh-cn")
    @JSONField(name = "clientlang")
    @JsonProperty("clientlang")
    private String clientlang;

    /**
     * zipcode
     */
    @JSONField(name = "zipcode")
    @JsonProperty("zipcode")
    private String zipcode;





    /**
     * 设置 [源代码账户]
     */
    public void setCommiter(String commiter){
        this.commiter = commiter ;
        this.modify("commiter",commiter);
    }

    /**
     * 设置 [真实姓名]
     */
    public void setRealname(String realname){
        this.realname = realname ;
        this.modify("realname",realname);
    }

    /**
     * 设置 [通讯地址]
     */
    public void setAddress(String address){
        this.address = address ;
        this.modify("address",address);
    }

    /**
     * 设置 [钉钉]
     */
    public void setDingding(String dingding){
        this.dingding = dingding ;
        this.modify("dingding",dingding);
    }

    /**
     * 设置 [手机]
     */
    public void setMobile(String mobile){
        this.mobile = mobile ;
        this.modify("mobile",mobile);
    }

    /**
     * 设置 [微信]
     */
    public void setWeixin(String weixin){
        this.weixin = weixin ;
        this.modify("weixin",weixin);
    }

    /**
     * 设置 [密码]
     */
    public void setPassword(String password){
        this.password = password ;
        this.modify("password",password);
    }

    /**
     * 设置 [电话]
     */
    public void setPhone(String phone){
        this.phone = phone ;
        this.modify("phone",phone);
    }

    /**
     * 设置 [性别]
     */
    public void setGender(String gender){
        this.gender = gender ;
        this.modify("gender",gender);
    }

    /**
     * 设置 [邮箱]
     */
    public void setEmail(String email){
        this.email = email ;
        this.modify("email",email);
    }

    /**
     * 设置 [最后登录]
     */
    public void setLast(Integer last){
        this.last = last ;
        this.modify("last",last);
    }

    /**
     * 设置 [访问次数]
     */
    public void setVisits(Integer visits){
        this.visits = visits ;
        this.modify("visits",visits);
    }

    /**
     * 设置 [账户]
     */
    public void setAccount(String account){
        this.account = account ;
        this.modify("account",account);
    }

    /**
     * 设置 [QQ]
     */
    public void setQq(String qq){
        this.qq = qq ;
        this.modify("qq",qq);
    }

    /**
     * 设置 [nickname]
     */
    public void setNickname(String nickname){
        this.nickname = nickname ;
        this.modify("nickname",nickname);
    }

    /**
     * 设置 [ip]
     */
    public void setIp(String ip){
        this.ip = ip ;
        this.modify("ip",ip);
    }

    /**
     * 设置 [avatar]
     */
    public void setAvatar(String avatar){
        this.avatar = avatar ;
        this.modify("avatar",avatar);
    }

    /**
     * 设置 [locked]
     */
    public void setLocked(Timestamp locked){
        this.locked = locked ;
        this.modify("locked",locked);
    }

    /**
     * 格式化日期 [locked]
     */
    public String formatLocked(){
        if (this.locked == null) {
            return null;
        }
        SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
        return sdf.format(locked);
    }
    /**
     * 设置 [clientLang]
     */
    public void setClientlang(String clientlang){
        this.clientlang = clientlang ;
        this.modify("clientlang",clientlang);
    }

    /**
     * 设置 [zipcode]
     */
    public void setZipcode(String zipcode){
        this.zipcode = zipcode ;
        this.modify("zipcode",zipcode);
    }

    /**
     * 复制当前对象数据到目标对象(粘贴重置)
     * @param targetEntity 目标数据对象
     * @param bIncEmpty  是否包括空值
     * @param <T>
     * @return
     */
    @Override
    public <T> T copyTo(T targetEntity, boolean bIncEmpty) {
        this.reset("id");
        return super.copyTo(targetEntity,bIncEmpty);
    }
}


